package com.zmht.beike.biz.impl;

import java.util.List;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.zmht.beike.biz.IAreainfoBiz;
import com.zmht.beike.core.BaseBizImpl;
import com.zmht.beike.po.TIareainfo;

public class IAreainfoBizImpl extends BaseBizImpl implements IAreainfoBiz {

	public List getAreainfo(Integer teacherId, int startIndex, int pageSize) {
		String hql = "from TIareainfo t where t.teacherId="+teacherId;
		return this.getIareainfoDAO().findByPage(hql, startIndex, pageSize);
	}

	public int getAreainfoTotal(Integer teacherId) {
		String hql = "from TIareainfo t where t.teacherId="+teacherId;
		return this.getIareainfoDAO().findByPageAmount(hql);
	}

	public Integer saveAreainfo(TIareainfo areinfo) {
		try{
			return (Integer)this.getIareainfoDAO().saveObj(areinfo);
		}catch(Exception e){
			return 0;
		}
		
	}
	public static void main(String [] args){
		ApplicationContext cxt;
		cxt = new ClassPathXmlApplicationContext(new String[]{"spring/spring.xml","spring/spring_dao.xml","spring/spring_beike.xml"});
		IAreainfoBizImpl biz = (IAreainfoBizImpl)cxt.getBean("iareainfoBizTag");
		List list = biz.getAreainfo(3, 0, 100);
		System.out.println(list.size());
	}
}
